package com.dubbo;

import com.alibaba.dubbo.spring.boot.annotation.EnableDubboConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.context.ConfigurableApplicationContext;

import java.io.IOException;

@SpringBootApplication
@EnableDubboConfiguration
@EnableHystrix//开启消费者的服务容错
public class ConsumerApplication {

    public static void main(String[] args) throws Exception {
        ConfigurableApplicationContext run =
                SpringApplication.run(ConsumerApplication.class, args);

        // 获取bean，添加@Component注解的类名首字母小写就是bean名
        HelloConsumer consumer = (HelloConsumer) run.getBean("helloConsumer");

        consumer.say("world");
        System.in.read();
    }
}
